package cn.dengta.webapp.trade.entity;

import java.util.Date;

import cn.dengta.common.model.BizFlag;
import cn.dengta.webapp.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * 用户等级
 *
 * @author lgy
 * @since 2022-11-28
 */
@Setter
@Getter
@Accessors(chain = true)
@TableName("dt_user_level")
public class UserLevel extends BaseEntity implements BizFlag.WritableBizFlag {

	/** 标识：是否拥有L1头像 */
	public static final long BIZ_L1_AVATAR = 1L;

	/** 总经验 */
	private Long exp;
	/** 等级 */
	private Integer level;
	/** 业务标识 */
	private long bizFlag;
	/** 创建时间 */
	private Date addTime;

	public UserLevel init(Long userId, Date now) {
		this.exp = 0L;
		this.level = 0;
		this.bizFlag = 0L;
		this.addTime = now;
		this.id = userId;
		return this;
	}

	public static boolean disabled() {
		return false;
	}

	@Override
	public void setBizFlag(long bizFlag) {
		this.bizFlag = bizFlag;
	}

	public static final String EXP = "exp";
	public static final String LEVEL = "level";
	public static final String BIZ_FLAG = "biz_flag";
	public static final String ADD_TIME = "add_time";

}
